package ua.javatr.android.smb;

import android.app.Activity;
import android.app.ListFragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;

/**
 * Created by Вячеслав on 11.06.2014.
 */
public class CardOperationsListFragment extends ListFragment {

    String[] operations = {"Посмотреть баланс", "Пополнить телефон", "Заблокировать карту"};

    OnOperationSelectedListener onOperationSelectedListener;

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        onOperationSelectedListener = (OnOperationSelectedListener) activity;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, operations);
        setListAdapter(adapter);
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    public void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);
        DialogFragmentPhoneRecharge dfpr = new DialogFragmentPhoneRecharge();
        dfpr.show(getFragmentManager(),"dialog_pay");
    }

    public interface OnOperationSelectedListener {
        public void onOperationSelected();
    }

}
